package interfaceandabstract.exercise;

public class Test {

    public static void main(String[] args) {
        Animal dog = new Dog("公", "旺财", 3, 100);
        Animal cat = new Cat("母", "Tom", 5, 200);
        Animal duck = new Duck("母", "唐纳德", 4, 50);
        Animal mouse = new Mouse("公", "Jerry", 3, 120);

        dog.bark();
        cat.bark();


        if (((Dog) dog).catchMouse((Mouse) mouse)) {
            System.out.println("狗狗捉到了老鼠");
        } else {
            System.out.println("狗狗放走了老鼠");
        }

        if (((Cat) cat).catchMouse((Mouse) mouse)) {
            System.out.println("Tom捉到了老鼠");
        } else {
            System.out.println("Tom放走了老鼠");
        }


        ((Dog) dog).swim();
        ((Duck) duck).swim();
    }
}
